﻿/**
 * class Main
 * 系统的入口 
 * */
package cn.nkjobsearch.main;

import java.util.ArrayList;

import cn.nkjobsearch.convert.ConvertData;
import cn.nkjobsearch.convert.KeywordIndex;
import cn.nkjobsearch.publicClass.SearchAndSort;
import cn.nkjobsearch.search.Search;
import cn.nkjobsearch.html.Com51JobController;
import cn.nkjobsearch.html.ComChinaHRController;
import cn.nkjobsearch.html.ComZhilianController;
import cn.nkjobsearch.jena.NKJSJena;
import cn.nkjobsearch.mysql.MysqlConn;

public class Main {
	static void getId(){
		ComChinaHRController chrController = new ComChinaHRController();
		chrController.startGetID();
		chrController.startGetHTML();

		ComZhilianController czpController = new ComZhilianController();
		czpController.startGetID();
		czpController.startGetHTML();

		Com51JobController job51Controller = new Com51JobController();
		job51Controller.startGetID();
		job51Controller.startGetHTML();
	}
	
	static void convertData(int couvertNum) {
		ConvertData da = new ConvertData();
		da.go(couvertNum);
	}
	
	static void search() {
		Search s = new Search();
		s.go("java软件工程师");
//		s.go("数据库管理员");
	}
	
	static void jena() {
		NKJSJena jn = new NKJSJena();
		if(true) {
			ArrayList<int[]> rs = jn.findKeyword(1);
			for (int i = 0; i < rs.size(); i++) {
				int o[] = rs.get(i);
				System.out.println(o[0] + "\t" + o[1]);
			}
		}
		
		if(true) {
			ArrayList<Integer> rs2 = jn.findCity(10, false);
			for (int i = 0; i < rs2.size(); i++) {
				System.out.println(rs2.get(i));
			}
		}
	}

	static void mergeListIntersection(ArrayList<int[]> list1, ArrayList<Integer> list2) {	
		int[] ia = new int[list2.size()];
		for (int i = 0; i < list2.size(); i++) {
			ia[i] = list2.get(i);
		}
		for(int i = 0; i<list1.size();) {
			int findIndex = SearchAndSort.binarySearch(ia, list1.get(i)[0]) ;
			//cn.nkjobsearch.publicClass.Print.print(findIndex);
			if(findIndex > -1) {	//found
				i++;
			} else {	//not found
				list1.remove(i);
			}
		}
	}
	
	static void test() {
		ArrayList<int[]> l1 = new ArrayList<int[]>();
		l1.add(new int[]{1,1});
		l1.add(new int[]{10,1});
		l1.add(new int[]{2,1});
		l1.add(new int[]{3,1});
		l1.add(new int[]{6,1});
		l1.add(new int[]{4,1});
		ArrayList<Integer> l2 = new ArrayList<Integer>();
		l2.add(1);
		l2.add(2);
		l2.add(4);
		l2.add(6);
		l2.add(8);
		l2.add(11);
		mergeListIntersection(l1,l2);
		cn.nkjobsearch.publicClass.Print.print(l1);
	}
	
	public static void main(String[] args) { 
		test();
//		getId();
//		convertData(1);
//		search();
//		jena();
		System.out.println("Main Over!");
	}
}